#!/bin/sh

cd "`dirname "$0"`"

. ./version_info

addon_version="`echo "$addon_version" | tr -d '~-'`"
if [ "$addon_multiprocess" ] ; then
	multiprocess=',"multiprocess": true'
else
	multiprocess=''
fi

# TODO: Refactor things
cat <<EOF | sed 's/^\s*//' | tr -d '\n' > ./src/package.json
{
  "title": "${addon_name}"
  ,"name": "${addon_id}"
  ,"version": "${addon_version}"
  ,"description": "${addon_description}"
  ,"main": "index.js"
  ,"author": "${addon_author}"
  ,"engines": {
    "firefox": ">=38.0a1"
  }
  ,"license": "AGPL-3.0+"
  ,"permissions": {
    "private-browsing": true
    ${multiprocess}
  }
  ,"preferences": [
    {
      "name": "showHelp"
      ,"type": "bool"
      ,"value": true
      ,"title": "Show help on startup"
    }
    ,{
      "name": "showHelpOnce"
      ,"type": "bool"
      ,"value": true
      ,"title": "Disable 'help on startup' once shown"
    }
    ,{
      "name": "ignoreEnvironmentScript"
      ,"type": "bool"
      ,"value": false
      ,"title": "Do not load scripts specified in an environment variable"
    }
    ,{
      "type": "control"
      ,"name": "button-help"
      ,"label": "Help"
      ,"title": "Show help now"
    }
    ,{
      "type": "control"
      ,"name": "button-license"
      ,"label": "Show"
      ,"title": "License information"
    }
    ,{
      "type": "control"
      ,"name": "button-stop"
      ,"label": "Stop"
      ,"title": "Stop all running Zombie scripts now"
    }
    ,{
      "type": "file"
      ,"name": "temp-scriptPath"
      ,"title": "Run a Zombie script now"
    }
  ]
}
EOF

# vim: ts=4 noet ai

